package laity.interview.LinkedListRule;

import java.io.UnsupportedEncodingException;
import java.util.LinkedList;

import static sun.misc.Version.println;

/**
 * @author: Laity
 * @Project: JavaLaity
 * @Package: laity.interview.LinkedListRule.Rule
 * @Date: 2022年09月19日 15:47
 * @Description: 链表 LinkedList
 * <p>
 * 有序、双向链表
 */
public class Rule {
    public static void main(String[] args) throws UnsupportedEncodingException {
        LinkedList<Object> list = new LinkedList<>();
        list.add(11);
        list.add(22);
        list.add(33);
        list.add(44);
        list.add(55);
        list.add(66);
        list.forEach(System.out::println);

        test2();
        test3();
    }

    public static String test() {
        try {
            System.out.println("try");
            return "return";
        } catch (Exception e) {
            System.out.println(e.getMessage());
        } finally {
            System.out.println("finally");
        }
        return null;
    }

    public static void test2() {
        String result = test();
        System.out.println(result);
    }

    public static void test3() throws UnsupportedEncodingException {
        String a = new String("hello".getBytes("ISO-8859-1"), "GB2312");
        System.out.println(a);
    }
}
